package org.come.Jpanel;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import org.come.until.CutButtonImage;

import com.tool.btn.TaoBaoBtn;
import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;

/**
 * 商城充值面板
 * <p>
 * Title : RechargeJpanel
 * </p>
 * 
 * @author : HGC
 * @date : 2019年7月17日 上午9:40:01
 * @version : 1.0.0
 */
public class RechargeJpanel extends JPanel {

	private JLabel bannerImg; // 横幅图片

	private JLabel jadeLab, // 仙玉背景框
			jadeNum; // 仙玉数量

	private TaoBaoBtn btnhp,// 首页
			btnep,// 末页
			btnsyy,// 上一页
			btnxyy;// 下一页

	private int maxPage = 1; // 最大页码
	private int nowpage = 1; // 当前页数
	//
	private JLabel labpage; // 放置当前页数和总页数

	private RechargeLeftGoodsJpanel[] imageJpanel = new RechargeLeftGoodsJpanel[6]; // 展充值详细信息息

	public RechargeJpanel() {

		this.setPreferredSize(new Dimension(656, 445));
		this.setLayout(null);
		this.setOpaque(false);
		// this.setBackground(UIUtils.Color_BACK);
		// 放置当前页数和总页数
		labpage = new JLabel("1/1", SwingConstants.CENTER);
		labpage.setForeground(Color.white);
		labpage.setBounds(335, 378, 58, 17);
		labpage.setFont(UIUtils.TEXT_FONT1);
		this.add(labpage);

		// 首页
		btnhp = new TaoBaoBtn("skin/8100226/button/2.png", 1, "首页", 40);
		btnhp.setBounds(279, 378, 34, 17);
		this.add(btnhp);

		// 上一页
		btnsyy = new TaoBaoBtn("skin/8100226/button/10.png", 1, "", 41);
		btnsyy.setBounds(315, 378, 19, 20);
		this.add(btnsyy);

		// 下一页
		btnxyy = new TaoBaoBtn("skin/8100226/button/9.png", 1, "", 42);
		btnxyy.setBounds(397, 378, 19, 20);
		this.add(btnxyy);

		// 末页
		btnep = new TaoBaoBtn("skin/8100226/button/2.png", 1, "末页", 43);
		btnep.setBounds(416, 378, 34, 17);
		this.add(btnep);

		this.add(getBannerImg());
		this.add(getJadeNum());
		this.add(getJadeLab());

		// 展示的特效信息
		for (int i = 0; i < 6; i++) {
			int row = i % 3;
			int col = i / 3;
			imageJpanel[i] = new RechargeLeftGoodsJpanel(null);
			imageJpanel[i].setBounds(54 + row * 205, 135 + col * 100, 200, 90);
			this.add(imageJpanel[i]);
		}

	}

	public JLabel getLabpage() {
		return labpage;
	}

	public void setLabpage(JLabel labpage) {
		this.labpage = labpage;
	}

	public JLabel getBannerImg() {
		if (bannerImg == null) {
			bannerImg = new JLabel();
			bannerImg.setBounds(54, 0, 600, 125);
			bannerImg.setOpaque(true);
			bannerImg.setBackground(Color.red);
		}
		return bannerImg;
	}

	public void setBannerImg(JLabel bannerImg) {
		this.bannerImg = bannerImg;
	}

	public TaoBaoBtn getBtnhp() {
		return btnhp;
	}

	public void setBtnhp(TaoBaoBtn btnhp) {
		this.btnhp = btnhp;
	}

	public TaoBaoBtn getBtnep() {
		return btnep;
	}

	public void setBtnep(TaoBaoBtn btnep) {
		this.btnep = btnep;
	}

	public TaoBaoBtn getBtnsyy() {
		return btnsyy;
	}

	public void setBtnsyy(TaoBaoBtn btnsyy) {
		this.btnsyy = btnsyy;
	}

	public TaoBaoBtn getBtnxyy() {
		return btnxyy;
	}

	public void setBtnxyy(TaoBaoBtn btnxyy) {
		this.btnxyy = btnxyy;
	}

	public RechargeLeftGoodsJpanel[] getImageJpanel() {
		return imageJpanel;
	}

	public void setImageJpanel(RechargeLeftGoodsJpanel[] imageJpanel) {
		this.imageJpanel = imageJpanel;
	}

	public int getMaxPage() {
		return maxPage;
	}

	public void setMaxPage(int maxPage) {
		this.maxPage = maxPage;
	}

	public int getNowpage() {
		return nowpage;
	}

	public void setNowpage(int nowpage) {
		this.nowpage = nowpage;
	}

	/** 展示仙玉背景框 */
	public JLabel getJadeLab() {
		if (jadeLab == null) {
			jadeLab = new JLabel();
			jadeLab.setIcon(CutButtonImage.getImage("inkImg/old/background/51.png", -1, -1));
			jadeLab.setOpaque(false);
			jadeLab.setBounds(60, 378, 124, 19);

		}
		return jadeLab;
	}

	public void setJadeLab(JLabel jadeLab) {
		this.jadeLab = jadeLab;
	}

	/** 当前人物仙玉数量 */
	public JLabel getJadeNum() {
		if (jadeNum == null) {
			jadeNum = new JLabel(RoleData.getRoleData().getLoginResult().getCodecard() + "");
			jadeNum.setBounds(103, 380, 80, 15);
			jadeNum.setOpaque(false);
			jadeNum.setForeground(Color.white);
			jadeNum.setFont(UIUtils.TEXT_COM_FONT);
		}
		return jadeNum;
	}

	public void setJadeNum(JLabel jadeNum) {
		this.jadeNum = jadeNum;
	}

}
